`
https://leetcode.cn/problems/minimum-length-of-string-after-deleting-similar-ends/
`

/**
 * @param {string} s
 * @return {number}
 */
var minimumLength = function (s) {
  let left = 0, right = s.length - 1
  while (left < right && s[left] === s[right]) {
    const c = s[left]
    while (left <= right && s[left] === c) left++
    while (left <= right && s[right] === c) right--
  }
  return right - left + 1
};